#include <iostream>
#include <math.h>
#include <set>


using namespace std;




int conciderar(int a, int b);
bool esPrimo(long int a);
int main()
{
long int sol = 0;

int res = 0;
int lala;

for (int a = -999; a < 1000;a++ )
{
    cout << a  << "(" << res <<")"<< "(" << sol <<")"<< endl;
	for (int b = -999 ;b < 1000 ; b++ )
	{
	lala = conciderar(a,b);
if(lala > res) {
    res = lala;
	sol = a*b;
	}
	}
}

cout << sol;
return 0;
}



int conciderar(int a, int b){

    bool bandera = false;
    int num;
int n;
    for (n = 0; !bandera; n++){

        num = n*n + a*n + b;
        if(num<2 or !esPrimo(num)) bandera = true;

        }
    return n-1;

    }

bool esPrimo(long int a)
{
    int i = 2;
 while (i <= (static_cast<long int>(sqrt(a)))){
     if (a%i == 0) return 0;
     i++;
     }
 return 1;


}




